KERNEL_DIR = /linux/rk3576/sdk/kernel-6.1/
SRC_DIR := $(shell pwd)
OUTPUT_DIR := $(SRC_DIR)/../../build

ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu-
EXTRA_CFLAGS = -fno-pic

obj-m += st7789_fb.o



OBJ_FILE = *.ko
RM_OBJ_FILES :=  *.o *.mod *.mod.* .*.cmd Module.symvers modules.order


all:
	$(MAKE) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
		-C $(KERNEL_DIR) M=$(SRC_DIR)  modules


	rm -f $(RM_OBJ_FILES)
	mv -f $(OBJ_FILE) $(OUTPUT_DIR)/

debug:
	@echo "build dir: $(OUTPUT_DIR)"

clean:
	$(MAKE)  -C $(KERNEL_DIR) M=$(SRC_DIR) O=$(OUTPUT_DIR) clean

.PHONY: all clean debug
